import torch
import torch.nn as nn

# 假设outputs和labels是已经计算好的
outputs = torch.tensor([[0.0960], [0.0869]], requires_grad=True)
labels = torch.tensor([[1], [0]],dtype=torch.float)

# 定义损失函数
criterion = nn.BCELoss()

# 计算损失
loss = criterion(outputs, labels)

print(loss)